package org.lwz.space.dao.impl;

import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.lwz.space.dao.UserDao;
import org.lwz.space.model.User;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Liaowz on 2015/10/16.
 */
@Repository(value = "userDao")
public class UserDaoImpl extends BaseDaoImpl<User> implements UserDao {

    @Override
    public User getUser(String userName, String password) {
        Query query = getSession().createQuery("FROM User where userName = :userName and password=:password");
        query.setParameter("userName", userName);
        query.setParameter("password", password);
        return (User) query.uniqueResult();
    }
}
